Conversation
Right now, the DB logic was written to support only sqlite3. As we're aiming to add support for other databases, use a more generic way to describe DB fields. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Convert sqlite3-specific bindings into a generic one inside ras-record, to allow adding support later for other databases. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
In preparation for adding support to other databases, don't keep any sqlite3 stuff outside ras-record. For now, we'll keep HAVE_SQLITE3 as an intermediate step, as right now the only SQL supported database is sqlite3. In the future, this will be broken on two separate fields, and the checks inside each rasdaemon file will disapear, as the SQL backend core will take care of it. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Those should be 644, not 755. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Right now, rasdaemon is only partially modular: at build time, each individual feature can be selected and added, but the code requires lots of ifdefs. This worked fine at the beginning when there weren't much options, but now the code has lots of optional features. Use a more modular design by adding a module register logic. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
As the project grew, there are now too much files at the core directory, making harder to maintain. Move them to subdirs. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Make it more generic, aiming to allow automatic module load via __attribute__((constructor)). Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
As we're aiming to let module registration to happen in any order, make the logic deterministic by inserting modules in alphabetic order. This makes insert being O(n) instead of O(1), but performance here is not a problem. While here, fix a bug when checking if allocation succeded. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
While the code compiles, it fails at the test cases. Fix the issues. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Add unit tests to check if modules logic works. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Allow modules to optionally set a private data and ensure that cleanup will receive enough context. This is needed to check modules functionality via unit tests, and could help to ensure that cleanup will do the right thing. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ensure that init and cleanup logic will work as expected. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Instead of relying on manual conference, check programaticly if module cleanups will happen at the expected way. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
When doing unit tests, it doesn't make any sense to write at
syslog. Also, on success, the normal behavior is to just mask
the error output.
Implement support for it and modify tests/test-modules to
use such feature.
After such change, a successful run will be cleaner:
Testing modules functionality:
01/06: Running NULL entry
02/06: Running single module
03/06: Running modules in order
04/06: Running modules out of order
05/06: Running multiple levels
06/06: Running init/cleanup
All module registration tests passed.
And if the logs are always shown, there will be a tab on
each new line, which will produce a better visual output
as well:
Testing modules functionality:
01/06: Running NULL entry
module entry is missing!
02/06: Running single module
03/06: Running modules in order
04/06: Running modules out of order
05/06: Running multiple levels
06/06: Running init/cleanup
module alpha enabled
module charlie enabled
module foxtrot enabled
module delta enabled
module echo enabled
module beta enabled
All module registration tests passed.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Move all sqlite3-specific logit to db/ras-db, preparing the code to support other databases in the future. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
change the namespace for all database-related ops. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Use kernel-doc style markups to document the database generic interface. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
The code there contains only sqlite3 specifics. Rename it to better reflect its content. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
In preparation to support other database types, add an abstraction layer. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
As the idea is to make the logic more modular to give more flexibility and remove ifdef code from rasdaemon, move the DB backend initialization to be done via module register. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Forgot to add ras-db code on a previous commit. While here, update .gitignore. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This is useful for unit tests. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
mchehab
force-pushed
the
next
branch
2 times, most recently
from
August 11, 2026 12:01
45e9484 to
38bf93a
Compare
Add a way to check if db-sqlite3 implementation is working. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
When creating or altering table, add index for timestamp and hostnames, as those are the fields which will likely need more. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Instead of duplicating everything inside ras-mc-ctl.8.in, dynamically create man pages from what's there at ras-mc-ctl. That helps keeping it sane from maintainership PoV. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
As rasdaemon now create index automatically at table creation or alter table time, there's no need to create it on python, maybe except if one is running it with a database created with an old version. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
A previous change during the change to a more generic DB backend ended dropping mc_event table creation/preparation. Re-add it. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
There are some minor discrepancies between parameter handling on rasdaemon and ras-mc-ctl. Address them and make both support unix sockets. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Do some adjustments at parameter handling and change the default database to rasdaemon. The rasdaemon_test database is meant to be used only at unittests and Github actions. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
--until currently picks until last day at midnight. Increment day by one to select until the date at midnight. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
After code refactoring, such features were removed. Re-add them. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Allow controlling better the database queries Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
It is useful to have a general view about the number of errors per table. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Allow using a single letter for all command line args. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Add functionality tests for each rasdaemon feature Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
The changeset 6c1bc90 ("Reorganize source tree") reorganized rasdaemon tree, grouping similar features on separate dirs. Yet, the job was not perfect. Now that we're using meson, and in preparation to make features modular, do fine adjustments: - ensure that all events are inside an events dir; - add an event's dir for RISC-V; - the modules direction now contain only report logic. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Now that rasdaemon directories are in better shape, reorder includes, placing each group in alphabetical order. While here, drop handle_erst_mce() from ras-erst.h, as this is an static function. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
The current logic will bail out if rasdaemon is built without DB support, as there won't be a ras-mc-ctl db command. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
CI tests are currently failing because of ISO-8601 offset format. Use one that works with older versions. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
When building distro-specific packages, it is interesting to select them per architecture. Keep the default to build for all architectures, as this makes easier to test rasdaemon, but, at the Fedora package, select them depending on the target architecture. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Do an integrated tests between C and python code by adding per-database tests to insert data on a database and checking if ras-mc-ctl is getting data right. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Several new files are missing a copyright line; others have them with gpl-2.0 or later. Uniform them for all new files. While here, stop using GPL-2.0, as this was deprecated in SPDX 3.0, using, instead, GPL-2.0-only. No functional changes and no actual license changes, as the new files were always aimed to be GPL-2.0-only. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
We don't want to run unittests on all builds, as this is is a development-specific target. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
using sqlite3_bind_text() causes the blob to be badly displayed by ras-mc-ctl. Fix it by using the proper sqlite3_bind_blob() function. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Add some logic on such tests to avoid problems if DB support is not found. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ensure that the userspace tool will use the same parameters as the C file when running unittests. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Those were added during test creation, but they don't do anything useful. Drop them. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Simplify the code and ensure that fields will be properly be filled. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ensure that all archs will build fine. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Building Fedora with rawhide is failing, probably due to some unstable changes. So, instead, use a fixed version for it. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In preparation for rasdaemon version 1.0.0, improve its internal architecture.
Goals:
Updates:
TODO:
PR seems to be ready for merge.
I appreciate feedbacks and PRs against the
nextbranch to help with the redesign.